Makefile: use linuxkit env vars for org and builder config#5700
Makefile: use linuxkit env vars for org and builder config#5700europaul wants to merge 2 commits intolf-edge:masterfrom
Conversation
Introduce mk/linuxkit.mk (included from the top-level Makefile) to
consolidate all linuxkit build logic in one place and support three
acquisition modes, selected in priority order:
1. LINUXKIT_SRC=/path — build from a local source tree; make
tracks Go source changes as dependencies.
2. LINUXKIT_GIT_URL set — clone at LINUXKIT_GIT_REF (commit hash)
and build the binary.
3. (neither) — download the upstream release binary.
Mode 2 requires a commit hash (not a branch name) for reproducibility.
The hash is used directly as the versioned binary name — no network
call at parse time. Make skips the recipe if the binary already
exists (cached). Use git ls-remote to update the pinned hash.
Defaults to upstream linuxkit at the current master tip:
LINUXKIT_GIT_URL = https://github.com/linuxkit/linuxkit
LINUXKIT_GIT_REF = 4cfb70d3cc9256024bb0d4de760c631df0ad06f6
Set LINUXKIT_GIT_URL="" to revert to the release download (mode 3).
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
docs/BUILD.md
Outdated
| EVE's build system allows to override the default docker registry through the `REGISTRY` variable. For example: | ||
| EVE's build system provides two environment variables for this: | ||
|
|
||
| - `LINUXKIT_PKG_ORG` — overrides the registry organization used for pushing and pulling package images. |
linuxkit now supports environment variables for flags previously threaded through every linuxkit call site in this Makefile. Remove LINUXKIT_ORG_TARGET and BUILDKIT_CONFIG_OPTS workarounds: - Drop BUILDKIT_CONFIG_FILE / BUILDKIT_CONFIG_OPTS variables and the manifest-mode guard; replace with LINUXKIT_BUILDER_CONFIG env var which defaults to /etc/buildkit/buildkitd.toml if the file exists - Drop LINUXKIT_ORG_TARGET from all linuxkit call sites (9 locations) - Drop REGISTRY make variable; use LINUXKIT_PKG_ORG directly Update docs/BUILD.md to document the new variables: - LINUXKIT_PKG_ORG for pushing to a custom registry - LINUXKIT_MIRROR for pull-through proxy configuration Migration: make REGISTRY=myregistry -> LINUXKIT_PKG_ORG=myregistry/lfedge make For buildkit registry mirrors, LINUXKIT_BUILDER_CONFIG auto-detects /etc/buildkit/buildkitd.toml as before; override by setting LINUXKIT_BUILDER_CONFIG explicitly in the environment. For pull-side mirrors, set LINUXKIT_MIRROR in the runner environment. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com> Signed-off-by: Paul Gaiduk <paulg@zededa.com>
754d81d to
39d43d5
Compare
|
@rucoder yes, just to move faster - this will spare us trying to publish every PR individually from master and STILL failing due to 429, but blocking runners at the same time. Let's backport once we verify that this fix actually works |
| @@ -0,0 +1,78 @@ | |||
| # Copyright (c) 2026 Zededa, Inc. | |||
There was a problem hiding this comment.
Doesn't make much sense to create a folder for only one file. Are you planning to migrate other .mk files to this folder? If so, ok. Otherwise, please, remove it from the folder and just let in the root of the repo, like the kernel ones....
| To speed up builds by caching upstream images locally, use `LINUXKIT_MIRROR` to point at a pull-through registry mirror: | ||
|
|
||
| ```sh | ||
| make LINUXKIT_MIRROR="http://localhost:5001" pkgs eve |
There was a problem hiding this comment.
@rene yes, correct. by default we override docker.io AFAIR
There was a problem hiding this comment.
but it is better to specify a full syntax of-course like here linuxkit/linuxkit#4205
There was a problem hiding this comment.
yes, if the registry like docker.io= isn't set then it's applied to all registries
https://github.com/linuxkit/linuxkit/blob/master/docs/packages.md#L394
https://github.com/linuxkit/linuxkit/blob/master/src/cmd/linuxkit/cmd.go#L124
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5700 +/- ##
==========================================
+ Coverage 19.52% 29.45% +9.92%
==========================================
Files 19 18 -1
Lines 3021 2417 -604
==========================================
+ Hits 590 712 +122
+ Misses 2310 1554 -756
- Partials 121 151 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Supersedes #5669, depends on #5699.
Adopt linuxkit's native environment variable support for registry and
builder configuration, removing the Makefile-level workarounds that
threaded flags through every
linuxkitcall site.Removed:
BUILDKIT_CONFIG_FILE/BUILDKIT_CONFIG_OPTSvariables and themanifest-mode guardLINUXKIT_ORG_TARGETvariable and its injection at 9 call sitesREGISTRYmake variable (was only used to feedLINUXKIT_ORG_TARGET)New interface — set in the runner environment or on the make command line:
make REGISTRY=myregistryLINUXKIT_PKG_ORG=myregistry/lfedge makeBUILDKIT_CONFIG_FILE=/etc/buildkit/buildkitd.toml(auto-detected)LINUXKIT_BUILDER_CONFIG=/path/to/buildkitd.toml(explicit)LINUXKIT_MIRROR=docker.io=http://my-mirror.localLINUXKIT_BUILDER_CONFIGdefaults to/etc/buildkit/buildkitd.tomlif the file exists, matching previous behavior.Updates
docs/BUILD.mdto documentLINUXKIT_PKG_ORGandLINUXKIT_MIRRORusage for local registries and pull-through proxies.How to test and validate this PR
makewithout any overrides should behave identically to before.LINUXKIT_PKG_ORG=myregistry/lfedge makeshould tag/push packages tomyregistry/lfedge/*.LINUXKIT_BUILDER_CONFIG=/etc/buildkit/buildkitd.tomlon a runner that has the file; verify buildkit uses the mirror config.Changelog notes
No user-facing changes. Build tooling simplification: linuxkit registry mirror and org configuration is now passed via environment variables (
LINUXKIT_BUILDER_CONFIG,LINUXKIT_PKG_ORG,LINUXKIT_MIRROR) instead of make variables, making CI runner configuration more transparent.PR Backports
Checklist